package cn.lf.config;

import cn.lf.constant.MinioConstants;
import io.minio.MinioClient;

import java.util.Objects;

/**
 * @author guoyy
 */
public class MinioInitialization {

    private static MinioClient minioClient;

    private static MinioClient createClient(){

        return new MinioClient.Builder()
                .endpoint(MinioConstants.MINIO_ENDPOINT)
                .credentials(MinioConstants.MINIO_ACCESS_KEY,MinioConstants.MINIO_SECRET_KEY)
                .build();

    }

    public static MinioClient getClient(){

        if (Objects.isNull(minioClient)){

            minioClient = MinioInitialization.createClient();

        }

        return minioClient;

    }
}
